package com.dunshan.hprose.impl;

import com.alibaba.fastjson.JSON;
import com.dunshan.hprose.pojo.User;
import com.dunshan.hprose.service.DunshanHpService;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;

/**
 * @author LiWen
 * @version 1.0
 * @Date: 2021-05-04 15:21
 * @Description: hpros接口实现
 */
@Service
public class DunshanHpServiceImpl implements DunshanHpService {
    @Override
    public String sayHello(String request) {
        HashMap<String, Object> map = new HashMap<>();
        System.out.println(request);
        User user = new User();
        user.setName("7DGroup");
        user.setAge(18);
        map.put("success", user);
        return JSON.toJSONString(map);
    }

    @Override
    public String sayBye(String request) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("200", "性能工具之Jmeter压测Hprose RPC服务");
        map.put("ok", request);
        map.put("date", new Date());
        return JSON.toJSONString(map);
    }

    @Override
    public String getUser(String request) {
        HashMap<String, Object> map = new HashMap<>();
        map.put("error", "性能测试");
        map.put(request, "基础测试  Hprose RPC服务 ");
        return JSON.toJSONString(map);
    }
}
